package packing.coding;

import java.util.Objects;

public class Student implements Comparable<Student> {
    private int stuId;
    private String name;
    private float score;
    public Student(int stuId,String name ,float score){
        this.setName(name);
        this.setScore(score);
        this.setStuId(stuId);
    }

//    @Override
//    public boolean equals(Object o) {
//        System.out.println("================");
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//
//        Student student = (Student) o;
//
////        System.out.println(stuId == student.stuId && Float.compare(student.score, score) == 0 && Objects.equals(name, student.name));
//
//        return stuId == student.stuId && Float.compare(student.score, score) == 0 && Objects.equals(name, student.name);
//    }

    @Override
    public int hashCode() {
        return Objects.hash(stuId, name, score);
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuId=" + stuId +
                ", name='" + name + '\'' +
                ", score=" + score +
                '}';
    }


    public int getStuId() {
        return stuId;
    }

    public void setStuId(int stuId) {
        this.stuId = stuId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public float getScore() {
        return score;
    }

    public void setScore(float score) {
        this.score = score;
    }

    @Override
    public int compareTo(Student o) {
        return this.name.compareTo(o.name);
    }
}
